[Contents] [Previous] [Next] [Last]
This section provides information about changes to the equality
operators and the new delete
operator.
If the <SCRIPT>
tag uses LANGUAGE=JavaScript1.2
, the
equality operators (==
and !=
) work differently. This section
describes how the equality operators work without LANGUAGE=JavaScript1.2
and
how they work with LANGUAGE=JavaScript1.2
. For instructions on writing code
to convert strings and numbers, see "Data
Conversion".
This approach avoids errors, maintains transitivity, and simplifies the language.
To write JavaScript code that converts strings to numbers and numbers to strings in the different versions of Navigator, follow these guidelines:
When writing for all versions of Navigator:
"" + 3 == "3"
"3" - 0 == 3
!!null == false
When writing for Navigator 4.0 only:
var x = 3 String(x) = "3"
var x = "3" Number(x) = 3
var x = null Boolean(x) = false
The following example demonstrates the ==
operator with different <SCRIPT>
tags.
Core operator. Deletes an object's property or an element at a specified index in an array.
delete objectName.property delete objectname[index] delete property
property
is an existing property. (The third form is legal only within a with
statement.)
index
is an integer representing the location of an
element in an array.
If the deletion succeeds, the delete operator sets the property or element to undefined
.
delete
always returns undefined.
[Contents] [Previous] [Next] [Last]
Last Updated: 10/22/97 11:48:09
Copyright ⌐ 1997 Netscape Communications Corporation